// pages/detail/pic.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    item: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let id = options.id
    this.getDetail(id)
  },

  getDetail(id) {
    wx.cloud.callFunction({
      name: 'read',
      data: {
        id,
        $url: 'picDetail'
      }
    }).then(res => {
      let data = res.result.data
      let item = {
        img_url: data.hp_img_url,
        title: data.hp_author,
        forward: data.hp_content,
        words_info: data.text_authors
      }
      let date = data.hp_makettime.substring(0, 10)
      wx.setNavigationBarTitle({
        title: date
      })
      this.setData({
        item
      })
    })
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})